<template>
  <el-container class="container">
    <el-header style="text-align: center">
      <span class="ltitle"> MBTI </span>
    </el-header>
    <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      background-color="#7ac6f5"
      text-color="#fff"
      active-text-color="#ffd04b"
      @select="handleSelect"
    >
      <el-menu-item index="1">mbti测试</el-menu-item>
      <el-menu-item index="2">MBTI十六种人格类型</el-menu-item>
      <el-sub-menu index="3">
        <template #title>信息管理</template>
        <el-menu-item index="3-1">查询学生信息</el-menu-item>
        <el-menu-item index="3-2">添加学生信息</el-menu-item>
        <el-menu-item index="3-3">删除学生信息</el-menu-item>
        <el-menu-item index="3-4">修改学生信息</el-menu-item>
      </el-sub-menu>
      <el-menu-item index="4">返回登录页面</el-menu-item>
    </el-menu>
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: "Home",
  data(){
    return{
activeIndex2:'1'
    }
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
      if (key == "1") {
        this.$router.push("/Home/MbtiLogin");
      }
      if (key == "2") {
        this.$router.push("/");
      }
      if (key == "3-1") {
        this.$router.push("/");
      }
      if (key == "3-2") {
        this.$router.push("/");
      }
      if (key == "3-3") {
        this.$router.push("/");
      }
      if (key == "3-4") {
        this.$router.push("/");
      }
      if (key == "4") {
        this.$router.replace("/");
      }
    },
  },
};
</script>

<style scoped>
.container {
  height: 1000px;
}
.el-header {
  background-color: #7ac6f5;
  justify-content: space-between;
  align-items: center;
  padding-left: 0;
}

.ltitle {
  font-size: 30px;
  color: #ffffff;
  font-weight: 1000;
  line-height: 60px;
}
.el-container {
  background-color: #e0f1fc;
}
</style>
